<?php

namespace Viettrans\FrontBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\DependencyInjection\Container;

use Viettrans\FrontBundle\Form\ChoiceList\CategoriesList;
use Viettrans\FrontBundle\Form\ChoiceList\TypesList;

class UserType extends AbstractType {
    private $container;
    
    public function __construct(Container $container) {
        $this->container = $container;
    }
    
    public function buildForm(FormBuilder $builder, array $options) {
        $myChoicesListManager = $this->container->get('my_choices_list_manager');

        $builder->add('name', 'text', array(
			'label' => 'Tên liên hệ',
			'trim'  => true
		));
		
        $builder->add('locality', 'text', array(
			'label'=>'Thành phố',
			'trim'  => true
		));

        $builder->add('email', 'email', array(
			'label'=>'Email',
			'trim'  => true
		));

        $builder->add('telephone', 'text', array(
            'label'    => 'Điện thoại',
            'required' => false,
			'trim'  => true
        ));

		$builder->add('password', 'password', array(
			'label'=>'Mật khẩu',
			'trim'  => true
		));
		
		$builder->add('confirmPassword', 'password', array(
			'label'=>'Xác nhận mật khẩu',
			'trim'  => true
		));
	}

    public function getDefaultOptions(array $options) {
        return array(
            'data_class'      => 'Viettrans\FrontBundle\Entity\User',
            'csrf_protection' => false,
        );
    }
    
    public function getName() {
        return 'form_user_new';
    }
}